package com.tsingteng.cosfun.ui.message.chat;

import com.tsingteng.cosfun.bean.ChatBean;
import com.tsingteng.cosfun.bean.PullBlackBean;
import com.tsingteng.cosfun.bean.UploadReportBean;
import com.tsingteng.cosfun.callback.RxObserver;
import com.tsingteng.cosfun.http.RxSchedulers;
import com.tsingteng.cosfun.mvp.module.BaseModel;

import retrofit2.Callback;

/**
 * 私信页面M层
 * 常胜
 * 2018.8.16
 * */
public class ChatModel extends BaseModel implements IChatModel{
    @Override
    public void getOfficalNotification(String type, int page, int source, RxObserver<ChatBean> callback) {
        doRxRequest().getChatNotification(type,page,com.tsingteng.cosfun.common.Config.PAGE_SIZE,source).compose(RxSchedulers.io_main()).subscribe(callback);
    }

    @Override
    public void getPullBlackData(String user_id, RxObserver<UploadReportBean> callback) {
        doRxRequest().pullBlack(user_id).compose(RxSchedulers.io_main()).subscribe(callback);
    }

    @Override
    public void getSendMessage(String mContent, long sid, RxObserver<Integer> rxObserver) {
        doRxRequest().getChatSendMessage("MESSAGE",mContent,sid).compose(RxSchedulers.io_main()).subscribe(rxObserver);
    }

    @Override
    public void getChatRead(String type, int maxid, int sourceId, RxObserver<Integer> rxObserver) {
        doRxRequest().getChatReadReslt(type,maxid,sourceId).compose(RxSchedulers.io_main()).subscribe(rxObserver);
    }
    @Override
    public void getReadPullBlackStateInfo(int user_id, Callback<PullBlackBean> workCallback) {
        doRxRequest().readPullBlackBlack(user_id + "").enqueue(workCallback);
    }

    @Override
    public void getCancelPullBlackInfo(long user_id, Callback<PullBlackBean> workCallback) {
        doRxRequest().cancelPullBlack(user_id + "").enqueue(workCallback);
    }

}
